﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.OleDb;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
	public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public void tt()
    {
        Banco bd = new Banco();
        string conString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\bancosit.mdb";

        string sql = "SELECT * FROM usuarios";
        /*
         * codigo
         * nome
         * login
         * cidade -->
         * depto
         * secao
         * ramal
         * email
         * celular_ceee
         * celular_part
        */
        OleDbConnection conection = new OleDbConnection(conString);
        OleDbCommand comando = new OleDbCommand(sql, conection);

        OleDbDataReader dtreader;
        conection.Open();
        dtreader = comando.ExecuteReader();

        if (dtreader.HasRows)
        {
            while (dtreader.Read())
            {
                dtreader.GetValue(1);//nome
                dtreader.GetValue(2);//login
                dtreader.GetValue(6);//ramal
                dtreader.GetValue(7);//email
                dtreader.GetValue(8);//celceee
                dtreader.GetValue(9);//celpart

                dtreader.GetValue(4);//depto
                dtreader.GetValue(5);//secao
                //fazer inserir no novo banco estes valores.
                bd.Comando("INSERT INTO usuarios (nome, login, depto, secao, ramal, email, celular_ceee, celular_part)"+
                "VALUES ('" + dtreader.GetValue(1) + "','" + dtreader.GetValue(2) + "'," + dtreader.GetValue(4) + "," + dtreader.GetValue(5) + "" +
                ",'" + dtreader.GetValue(6) + "','" + dtreader.GetValue(7) + "','" + dtreader.GetValue(8) + "','" + dtreader.GetValue(9) + "')");
            }
        }
        conection.Close();
    }
}